#include <iostream>
#include <unistd.h>
#include <pthread.h>
using namespace std;

void*handle(void*args)
{
    int count =10;
    while(count)
    {
        printf("%s\n",(char*)args);
        sleep(1);  
        count--;  
    }
    return (void*)10;
}

int main()
{
    //创建新线程
    pthread_t id;   //id返回线程的id
    pthread_create(&id,nullptr,handle,(void*)"thread");
    printf("id:%ld\n",id);
    //等待线程
    void*ret;   //接收线程的线程的reval
    int m=pthread_join(id,&ret);

    printf("%lld\n",(long long)ret);
    // while(1)
    // {
    //     printf("main thread\n");
    //     sleep(2);
    // }
    return 0;
}